package com.by.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ServivE
 * @version 0.1
 * @className OriginConfig
 * @description
 * @date 2024/11/1 19:52
 * @since jdk17
 */
@Component
public class OriginConfig implements RequestOriginParser {

    /**
     * sentinel资源授权规则  白名单黑名单
     * @param request
     * @return
     */
    @Override
    public String parseOrigin(HttpServletRequest request) {
        String origin = request.getHeader("host");
        return origin;
    }
}
